package com.world.common.pojo.tree;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by gang on 2017/2/1.
 */
public class ZTreeNode {
    private String id;
    private String pId;
    private String name;
    private Boolean checked;
    private Boolean open;
    private String url;
    private List<ZTreeNode> children = new ArrayList<>();

    public ZTreeNode() {
    }

    public ZTreeNode(String id, String pId, String name, Boolean checked, Boolean open, String url) {
        this.id = id;
        this.pId = pId;
        this.name = name;
        this.checked = checked;
        this.open = open;
        this.url = url;
    }

    public Boolean getOpen() {
        return open;
    }

    public void setOpen(Boolean open) {
        this.open = open;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Boolean getChecked() {
        return checked;
    }

    public void setChecked(Boolean checked) {
        this.checked = checked;
    }

    public List<ZTreeNode> getChildren() {
        return children;
    }

    public void setChildren(List<ZTreeNode> children) {
        this.children = children;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getpId() {
        return pId;
    }

    public void setpId(String pId) {
        this.pId = pId;
    }

    public static ZTreeNode removeOnlyOneChildrenNode(ZTreeNode node) {
        while (node.getChildren().size() == 1) {
            node = node.getChildren().get(0);
        }
        return node;
    }
}
